<template>
  <div style="padding-bottom:100px">
    <van-nav-bar
      title="我的"
      left-text=""
      right-text=""
    />
    <van-panel v-for="(item,index) in list" @click="jump(item)">
      <template #header>
        <div class="van-cell van-panel__header"><div class="van-cell__title"><span>{{item.title}}</span><div class="van-cell__label">作者：{{item.user_name}}<br />
 时间：{{item.created_at}}</div></div><div class="van-cell__value van-panel__header-value"><span><img v-if="item.status == 1" src="../assets/y.png" /><img v-else src="../assets/d.png" /></span></div></div>
      </template>
    </van-panel>
    <van-divider dashed @click="getList" v-show="more">点击加载</van-divider>

    <Bottom></Bottom>
  </div>

</template>
<script>
  import { list } from '@/api/app'
  import { pushArray } from '@/utils/app'
	import Bottom from '@/components/bottom'
export default {
  data() {
    return {
      user: this.$store.state.user,
      activeNames: ['1'],
      list: [],
      page: 0,
      more: false

    }
  },
  components: {
    Bottom
  },
  computed: {},
  mounted() {},
  created() {
    this.getList()
  },

  methods: {
    getList() {
      this.page += 1
      list({type: 'my', page: this.page}).then(res=>{
        if(res.total > res.per_page) {
          this.more = true
        }
        if(res.data.length == 0 && this.page >1) {
          this.more = false
          this.$toast('没有了')
          return 
        }
        this.list = pushArray(this.list, res.data)
      })
    },
    jump(row) {
      this.$router.push({name: 'Info', params: {id: row.id}})
    }
  }
}
</script>